extends "../../../azurlane_ctrl/Boss.gd"

var baseId = ""
func _extInit():
	._extInit()
	chaName = "「高级塞壬」代行者IX·Exploration"   #角色的名称
	attInfox.maxHp = 66666
	attInfox.atk = 600
	attInfox.mgiAtk = 500
	attInfox.def = 300
	attInfox.dod = 50
	attInfox.cd += 0.3
	attInfox.spd += 1
	attInfox.atkRan = 8
	lv = 4            #等级的设置
	ename = "daixingzhe9"
	addSkill("半血以上时，所受炮击伤害降低85%，半血以下时，所受技能伤害降低85%", "两极")
	addSkill("每{cd}秒，检测全场非塞壬角色：半血以下的敌人直接抹杀，半血以下的友军恢复满血", "逆行", "daixingzhe2", 6)
	addSkill("每阵亡一名友军单位，对当前目标造成3次[双攻*3]的技能伤害", "阴阳")

func _onHurt(atkInfo):
	._onHurt(atkInfo)
	if att.hp/att.maxHp > 0.5 and atkInfo.atkType == sys.AtkType.GUN:
		atkInfo.hurtVal *= 0.15
	if att.hp/att.maxHp <= 0.5 and atkInfo.atkType == sys.AtkType.SKILL:
		atkInfo.hurtVal *= 0.15

func _onCharaDel(cha):
	._onCharaDel(cha)
	if not is_instance_valid(cha):return
	if cha.team == team:
		for i in range(3):
			if cha.isDeath:break
			azurHurtChara(cha, (att.atk+att.mgiAtk)*3, sys.HurtType.WEAPON, sys.AtkType.SKILL, "阴阳")

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "daixingzhe2":
		daixingzhe2()
	
func daixingzhe2():
	for i in getAllChas(1):
		if i.att.hp/i.att.maxHp < 0.5:
			i.forceHurtSelf(i.att.maxHp)
	for i in getAllChas(2):
		if i.att.hp/i.att.maxHp < 0.5 and i != self:
			healCha(i, i.att.maxHp)

func getItems():
	addItem(sys.newItem(itemData.rndGetEquipEx(itemData.EquipType.DEF)))		
	addItem(sys.newItem(itemData.rndGetEquipEx(itemData.EquipType.AP)))	
	addItem(sys.newItem(itemData.rndGetEquipEx(itemData.EquipType.AD)))

	for it in items:
		if it.has_method("upgrade"):
			it.upgrade()
			it.upgraded = true